package com.example.meitao.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by 星星 on 2016/8/11.
 */
public class PagerMeAdapter extends FragmentPagerAdapter {
    private List<Fragment> mFragment;
    private List<String> titles;
    public PagerMeAdapter(FragmentManager fm, List<Fragment> data, List<String> title) {
        super(fm);
        mFragment = data;
        titles = title;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragment.get(position);
    }

    @Override
    public int getCount() {
        return mFragment==null?0:mFragment.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles.get(position);
    }
}
